using System.Threading.Tasks;

namespace IQIGame.Onigao.Game
{
    /// <summary>
    /// net session连接器
    /// </summary>
    public interface INetSessionConnector
    {
        /// <summary>
        /// 连接服务器
        /// </summary>
        /// <param name="session"></param>
        /// <param name="token"></param>
        /// <param name="gameServerId"></param>
        /// <param name="accountServerId"></param>
        /// <returns></returns>
        Task<bool> ConnectServer(NetSession session, string token, string gameServerId, string accountServerId);
        /// <summary>
        /// 重连服务器
        /// </summary>
        /// <param name="session"></param>
        /// <returns></returns>
        Task<bool> ReconnectServer(NetSession session);
        /// <summary>
        /// 发送心跳包
        /// </summary>
        void SendHeartBeat();
        /// <summary>
        /// session关闭
        /// </summary>
        /// <param name="session"></param>
        /// <param name="active">是否被主动关闭</param>
        void OnSessionClosed(NetSession session, bool active);
        /// <summary>
        /// session断开, 可以尝试手动重连
        /// </summary>
        /// <param name="session"></param>
        void OnSessionDisconnected(NetSession session);
    }
}
